﻿Imports _1065144_1065164.DataProvider
Imports System.Data.SqlClient
Public Class QuanDAO
    Public Shared Function GetAll() As List(Of QuanDTO)
        Dim listQuan As New List(Of QuanDTO)
        Dim cn As SqlConnection = New SqlConnection(_strConnectionString)
        Dim cmd As New SqlCommand()
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "SelectQuanAll"
        cmd.Connection = cn
        cn.Open()

        Dim rd As SqlDataReader = cmd.ExecuteReader()
        While rd.Read()
            Dim loaiquan As QuanDTO = New QuanDTO()
            loaiquan.iMaQuan = rd.GetInt32(0)
            loaiquan.strTenQuan = rd.GetString(1)
            listQuan.Add(loaiquan)
        End While
        cn.Close()

        Return listQuan
    End Function
End Class
